#pragma once

#include "Serializable.h"
#include "Team.h"
#include "StlStringAndStreams.h"

class ServiceProvider;

// TeamManager has the ownership of Teams
class TeamManager : public Serializable
{
public:
	TeamManager(ServiceProvider* const i_sp);
	~TeamManager();

	void	Clear();
	void	Initialize();
	void	Update();
	void	EndSeasonUpdate(STD::stringstream& o_message);

	Team*	CreateNewTeam();
	const TeamVec& GetTeams() const;
	const STL::string& GetTeamName(const int i_teamID) const;
	Team* GetTeam(const int i_teamID) const;

	virtual	ZStream& Serialize(ZStream& o_stream) const;
	virtual ZStream& Deserialize(ZStream& i_stream);

private:
	TeamManager(const TeamManager&); // unimplemented
	TeamManager& operator=(const TeamManager&); // unimplemented

	static int NUMBERS_OF_TEAMS;

	ServiceProvider* m_sp;
	TeamVec m_teams;
};

inline const TeamVec& TeamManager::GetTeams() const 
{
	return m_teams;
}
